function addGoodVersion(obj){
    var form = document.getElementById('form');
    var input = document.createElement("input");
    input.setAttribute("type", 'hidden');
    input.setAttribute("name", 'goodId');
    input.setAttribute("value", obj.id);
    form.appendChild(input);
    form.action="/admin/toInsertGoodVersion"
    form.submit();
}
function insertGoodVersion(obj){
    var form = document.getElementById('form');
    var input1 = document.createElement("input");
    input1.setAttribute("type", 'hidden');
    input1.setAttribute("name", 'goodId');
    input1.setAttribute("value", document.getElementById('goodId').value);
    console.log("1")
    var input2 = document.createElement("input");
    input2.setAttribute("type", 'hidden');
    input2.setAttribute("name", 'goodVersionValue');
    input2.setAttribute("value", document.getElementById('goodVersionValue').value);
    console.log("2")
    var input3 = document.createElement("input");
    input3.setAttribute("type", 'hidden');
    input3.setAttribute("name", 'goodVersionPrice');
    input3.setAttribute("value", document.getElementById('goodVersionPrice').value);
    console.log("3")
    var input4 = document.createElement("input");
    input4.setAttribute("type", 'hidden');
    input4.setAttribute("name", 'goodVersionCount');
    input4.setAttribute("value", document.getElementById('goodVersionCount').value);
    console.log("4")
    form.appendChild(input1);
    form.appendChild(input2);
    form.appendChild(input3);
    form.appendChild(input4);
    form.action="/admin/insertGoodVersion"
    form.submit();
}
function updateGoodVersion(id){
    var form=document.getElementById("form");
    var input1 = document.createElement("input");
    input1.setAttribute("type", 'hidden');
    input1.setAttribute("name", 'versionId');
    input1.setAttribute("value", id);
    console.log(input1);
    var input2 = document.createElement("input");
    input2.setAttribute("type", 'hidden');
    input2.setAttribute("name", 'goodId');
    input2.setAttribute("value", document.getElementById('goodId').value);
    form.action="/admin/updateGoodVersion";
    form.appendChild(input1);
    form.appendChild(input2);
    form.submit();
}
function toUpdateGoodVersion(obj){
    console.log(document.getElementById(obj.id).innerHTML)
    document.getElementById(obj.id).innerHTML="保存"
    console.log(obj);
    var versionId=obj.id.replace('versionId','');
    document.getElementById("value"+versionId).disabled="";
    document.getElementById("price"+versionId).disabled="";
    document.getElementById("count"+versionId).disabled="";
    document.getElementById(obj.id).onclick = function() {
        updateGoodVersion(versionId);
    }
}
function deleteGoodVersion(obj){
    var form=document.getElementById("form");
    var input1 = document.createElement("input");
    input1.setAttribute("type", 'hidden');
    input1.setAttribute("name", 'versionId');
    input1.setAttribute("value", obj.id);
    console.log(input1);
    var input2 = document.createElement("input");
    input2.setAttribute("type", 'hidden');
    input2.setAttribute("name", 'goodId');
    input2.setAttribute("value", document.getElementById('goodId').value);
    form.action="/showAdmin/deleteGoodVersion";
    form.appendChild(input1);
    form.appendChild(input2);
    form.submit();
}